import {AfterContentChecked,AfterViewInit,Component,ElementRef,EventEmitter,Inject,Input,OnInit,Optional,Output,Renderer2,TemplateRef,ViewChild } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { ItemComponent } from '../item/item.component';
@Component({
  selector: 'xm-list',
  templateUrl: './list.component.html',
  styleUrls: ['./list.component.css']
})
export class ListComponent implements OnInit {
  itemComponent: ItemComponent[] = [];
  constructor() { }
  clickList(index:number){
    this.itemComponent[index].xmClick.emit();
  }
  addItem(value: ItemComponent): void {
    this.itemComponent.push(value);
  }

  removeItem(value: ItemComponent): void {
    this.itemComponent.splice(this.itemComponent.indexOf(value), 1);
  }
  ngOnInit() {
  }

}
